package pattern16;

import java.util.ArrayList;
import java.util.List;

/**
 * 具体的聚合对象
 *
 * @author wdl
 */
public class ConcreteAggregate implements IAggregate {
    private List<Object> items = new ArrayList<>();

    @Override
    public IIterator createIterator() {
        return new ConcreteIterator(this);
    }

    public int getCount() {
        return items.size();
    }

    public void add(Object value) {
        items.add(value);
    }

    public Object getByIndex(int index) {
        return items.get(index);
    }
}
